<#assign ctx=request.contextPath />
<!DOCTYPE html>
<html>
  <head>
	<title>${Func.getMainCompanyJc()?if_exists}管理平台</title>
	<link rel="shortcut icon" type="image/x-icon" href="${ctx}/assets/img/ezu.png" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="${ctx}/assets/css/bootstrap.css">
	<link rel="stylesheet" href="${ctx}/assets/css/scojs.css">
	<link rel="stylesheet" href="${ctx}/assets/css/sco.message.css">
	<link rel="stylesheet" href="${ctx}/assets/css/form.css">
	<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
	<link rel="stylesheet" href="${ctx}/assets/css/buttons.css" />
	<link rel="stylesheet" href="${ctx}/assets/css/jquery-labelauty.css"/>
	<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
	<style>
		/* autocomplete */
		div.ac {border: 1px solid #ccc;position: absolute;display: none;overflow: auto;background-color: #ffffff;z-index:998;}
		div.ac > ul {margin-top:10px;padding:0;}
		div.ac > ul > li {height:33px;line-height:33px;cursor:pointer;}
		div.ac > ul > li:hover{background:#eee;}
		div.ac > ul > li > div span {padding-left:15px;}
		div.ac > ul > li > div span em {color:red;font-style: normal;}
		.inputTime{
		   height:35px;
		   width:260px;
		   border:1px solid #ccc;
		   border-radius:4px;
		   padding:6px 12px;
		}
			ul { list-style-type: none;}
	        .dowebok > li { display: inline-block;}
			.dowebok > li { margin: 10px 0;}
			input.labelauty + label { font: 12px "Microsoft Yahei";}
			  .in{
	     z-index:2;
	  }
	</style>
  </head>
  <body>
  <div class="container" style="margin-left:5px;">
	<div class="tabbable">
	<ul class="nav nav-tabs">
		<@daijia>
			<#if default=="daijia">
				<li class="active"><a id="daijiaClick" href="#daijiaTab" data-toggle="tab">代驾订单</a></li>
			</#if>
		</@daijia>
		<@pao>
			<#if default=="paotui">
		    	<li class="active"><a id="errandClick" href="#errandTab" data-toggle="tab">跑腿订单</a></li>
		    </#if>
	    </@pao>
	    <@zhuan>
			<#if default=="zhuan">
		    	<li class="active"><a id="zhuanClick" href="#zhuanTab" data-toggle="tab">专车订单</a></li>
		    </#if>
	    </@zhuan>
	    <@freight>
		    <#if default=="freight">
		    	<li class="active"><a id="freightClick" href="#freightTab" data-toggle="tab">货运订单</a></li>
			</#if>
		</@freight>
	    <@zhuanxian>
		    <#if default=="zhuanxian">
		    	<li class="active"><a id="zhuanxianClick" href="#zhuanxianTab" data-toggle="tab">快车订单</a></li>
			</#if>
		</@zhuanxian>
	</ul>
	<div class="tab-content" style="margin-top:10px;">
		<#if default=="daijia">
		<div class="tab-pane active" id="daijiaTab">
			<div class="row">
				<form id="submit_form" action="${ctx}/order/create" class="form-horizontal" method="post">
					<input type="hidden" name="CSRFToken" <#if default=="daijia">value="${CSRFToken}" </#if>/>
					<div class="col-md-6">
						<div class="panel panel-default">
					    	<div id="allmap" style="z-index: 99999; height:700px;">
						    
			        		</div>
			        		<div class="table-responsive">
			        		<table id="memberOrders-table" class="table table-condensed table-bordered" style="display:none;">
								<tr style="font-size:14px;">
									<th>状态</th>
									<th>单号</th>
									<th>类型</th>
									<th>来源</th>
									<th>预约时间</th>
									<th>预约地</th>
								</tr>
							</table>
							</div>
						</div>
					</div>
					<div class="col-md-6">
						<div class="panel panel-default">
							<div class="panel-heading">
								输入代驾地点定位，或地图上右击定位
						    </div>
						    <div class="panel-body">
		    					<input type="hidden" id="clientId" name="clientId">
		    					<input type="hidden" id="longitude" name="longitude">
		    					<input type="hidden" id="latitude" name="latitude">
		    					<input type="hidden" id="toPlaceLongitude" name="toPlaceLongitude">
		    					<input type="hidden" id="toPlaceLatitude" name="toPlaceLatitude">
		    					<input type="hidden" id="fromPlaceDetail" name="fromPlaceDetail">
		    					<input type="hidden" id="toPlaceDetail" name="toPlaceDetail">
				               
				               <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户手机</span>
						            		<input class="form-control" id="clientPhone" name="clientPhone" type="text" value=""  required/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-info" style="font-size:14px;" id="membertype"></span>
					                </div>
				                </div>
				                 
				                <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
					                    	<span class="input-group-addon">客户姓名</span>
							            	<input class="form-control" id="clientName" name="clientName" type="text" value=""/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual">0元</span>
					                </div>
				                </div>
				                <div id="todayordernums_div" style="display:none;">
					                <div class="form-group">
					                	<div class="col-sm-6">
						                    <label><em>&nbsp;&nbsp;</em>总下单量：</label>
						                    <label>
								            	<p class="form-control-static" id="allcount"></p>
								            </label>
							            </div>
							            <div class="col-sm-6">
						                    <label><em>&nbsp;&nbsp;</em>总实际下单量:</label>
						                    <label>
								            	<p class="form-control-static" id="allnotcancelcount"></p>
								            </label>
							            </div>
					                </div>
					                <div class="form-group">
							            <div class="col-sm-6">
								            <label><em>&nbsp;&nbsp;</em>本月单量：</label>
						                    <label>
								            	<p class="form-control-static" id="monthcount"></p>
								            </label>
							            </div>
							            <div class="col-sm-6">
								            <label><em>&nbsp;&nbsp;</em>本月实际单量：</label>
						                    <label>
								            	<p class="form-control-static" id="monthnotcancelcount"></p>
								            </label>
							            </div>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-12" id="couponSelect">
				                    
					                </div>
				                </div>
			                 	<div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon">预约地址</span>
						                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="fromPlace" name="fromPlace" type="text" value="${order.fromPlace?if_exists}" autocomplete="off" required/>
						                    <span class="input-group-btn">
					                            <button class="btn btn-default" type="button" id="btn-position">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon">目的地址</span>
						                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="toPlace" name="toPlace" type="text" value="${order.toPlace?if_exists}" autocomplete="off" required/>
						                    <span class="input-group-btn">
					                            <button class="btn btn-default" type="button" id="btn_toPlace">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
						                
				                <div class="form-group">
				                	<div class="col-sm-12">
				                	 	<div class="input-group ">
					                		<span class="input-group-addon" >预约时间</span>
							                <input class="form-control"  id="serverDate" name="serverD" type="text" value="${(order.serverTime)?string('yyyy-MM-dd')}" required/>
							            	<div class="input-group-btn" style="width:20%">
							            		<input class="form-control"  id="serverTime" name="serverT" type="text" value="${(order.serverTime)?string('HH:mm')}" required/>
							            	</div>
						                </div>
						              </div>
				                </div>
				                
				                <div class="form-group">
				                	<div class="col-sm-6">
					                	<div class="input-group">
					                    	<span class="input-group-addon">人数</span>
							            	<input class="form-control" id="driverNum" name="driverNum" type="number" value="1" required min="1" max="10"/>
						                </div>
					                </div>
				                    <div class="col-sm-6">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">介绍人</span>
						            	<input placeholder="本单介绍人:某某酒店" class="form-control" id="fromSource" name="fromSource" type="text" <#if order??> value="${order.fromSource?if_exists}" </#if>/>
					                	</div>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">所属公司</span>
						            	<select class="form-control" id="companyId" name="companyId"/>
						            		<#list companys as c>
						            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
						            		</#list>
						            	</select>
					                	</div>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">客户经理</span>
						            	<select class="form-control" id="weixinManagerId" name="weixinManagerId"/>
						            		<option value="">--无--</option>
						            		<#list weixinManagers as weixinManager>
						            			<option value="${weixinManager.id}" <#if weixinManagerId?? && weixinManagerId==weixinManager.id>selected="selected"</#if>>${weixinManager.name?if_exists}</option>
						            		</#list>
						            	</select>
					                	</div>
					                </div>
			                	</div>
			                	
			                	<@shiro.hasPermission name='orderFixPrice'>
					                <div class="form-group">
					                    <label><em>&nbsp;&nbsp;</em>订单定价</label>
					                    <label>
							            	<input id="fixPrice" name="fixPrice" type="checkbox" <#if order.fixPrice>checked="checked"</#if> />
							            </label>
					                </div>
					                
					                <div id="fixPrice_div" <#if !order.fixPrice>style="display:none;"</#if>>
					                	<div class="form-group">
						                    <div class="col-sm-12">
						                    	<div class="input-group">
						                    	<span class="input-group-addon">定价金额</span>
								            	<input class="form-control" id="fixPriceMoney" name="fixPriceMoney" value="${order.shouldCash?if_exists}" type="number" min="0" required/>
							                	<span class="input-group-addon">元</span>
							                	</div>
							                </div>
						                </div>
					                </div>
				                </@shiro.hasPermission>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<span class="input-group-addon">预估金额</span>
							            	<input class="form-control" id="yuguMoney" name="yuguMoney" value="${order.shouldCash?if_exists}" type="number" min="0" required/>
							            	<span class="input-group-addon">元</span>
					                	</div>
					                </div>
				                </div>
						                
				                <div class="form-group">
							 	 	<div class="col-sm-3">
				            	 	</div>
							 		<div class="col-sm-9 detail">		               
					                  <span class="mileage_daijai"></span>&nbsp&nbsp<span class="travelTime_daijia"></span>
					                </div>
				                </div>
						                
				                <div class="form-group">
				                    <label><em>&nbsp;&nbsp;</em>订单备注：</label>
				                    <div class="col-sm-12">
						            	<textarea class="form-control" cols="20" id="memo" name="memo" rows="2"><#if order??>${order.memo?if_exists}</#if></textarea>
					                </div>
				                </div>
		    					
		    					<@shiro.hasPermission name='ordercreate'>
				                <div class="form-group">
				                	<div class="col-sm-12">
					                	<input type="button" class="btn btn-primary btn-block" id="create-order" value="创建订单">
					                </div>
					            </div>
					            </@shiro.hasPermission>
					            
					            <div class="table-responsive">
					        		<table id="drivers-table" class="table table-condensed table-bordered">
										<tr style="font-size:14px;">
											<th>#</th>
											<th>服务人员姓名</th>
											<th>距离(公里)</th>
											<th>本日代驾</th>
											<th>本月代驾</th>
										</tr>
									</table>
								</div>
			        		</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		</#if>
		<#if default="zhuan">
		  <div class="tab-pane active" id="Tab">
		    <div class="row">
		  	<form action="" method="post" class="form-horizontal">
		  		<input type="hidden" id="zj_passengerId" value="<#if zhuanOrder??>${zhuanOrder.passengerId}"</#if>>
		  		<input type="hidden" id="zj_passengerPhone" value="<#if zhuanOrder??>${zhuanOrder.passengerPhone}</#if>">
	  			<input type="hidden" id="zj_startLat" value="<#if zhuanOrder.startLat??>${zhuanOrder.startLat}</#if>">
		  		<input type="hidden" id="zj_startLng" value="<#if zhuanOrder.startLng??>${zhuanOrder.startLng}</#if>">
		  		<input type="hidden" id="zj_endLat"  value="<#if zhuanOrder.endLat??>${zhuanOrder.endLat}</#if>">
		  		<input type="hidden" id="zj_endLng" value="<#if zhuanOrder.endLng??>${zhuanOrder.endLng}</#if>">
		  		<input type="hidden" id="zj_startAddressDetail" value="<#if zhuanOrder.startAddressDetail??>${zhuanOrder.startAddressDetail}</#if>">
	  			<input type="hidden" id="zj_endAddressDetail" value="<#if zhuanOrder.endAddressDetail??>${zhuanOrder.endAddressDetail}</#if>">
	  			<input type="hidden" id="serviceType" value="<#if zhuanOrder.serviceType??>${zhuanOrder.serviceType}</#if>">
	  			<input type="hidden" id="carTypeId" value="${zhuanOrder.carTypeId}">
	      		<input type="hidden" id="carTypes">
			 	<div class="row">
				<div class="col-md-6">
					<div class="panel panel-default">
		  				<div id="zj_allmap3" style="z-index: 99999; height:700px;">
						</div>
					</div>
				</div>
				<div class="col-md-6" >
					<form id="submit_form3" action="#" class="form-horizontal" method="post">
						<div class="panel-heading">
							<ul class="nav nav-tabs " id="serviceTypes" style="margin-left:10px;cursor:default;">
								<li serviceType="tangzu" <#if zhuanOrder.serviceType=="tangzu">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>立即用车</a></li>
								<li serviceType="rizu" <#if zhuanOrder.serviceType=="rizu">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>日租</a></li>
								<li serviceType="banrizu" <#if zhuanOrder.serviceType=="banrizu">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>半日租</a></li>
								<li serviceType="jieji" <#if zhuanOrder.serviceType=="jieji">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>接机</a></li>
								<li serviceType="songji" <#if zhuanOrder.serviceType=="songji">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>送机</a></li>
								<li serviceType="jiezhan" <#if zhuanOrder.serviceType=="jiezhan">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>接站</a></li>
								<li serviceType="songzhan" <#if zhuanOrder.serviceType=="songzhan">class='active'</#if>><a data-toggle='serviceTab' class='serviceType'>送站</a></li>
				            </ul>
					    </div>
				 		<div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户电话</span>
				            		<input class="form-control" id="passengerPhone3"  type="text" value="${zhuanOrder.passengerPhone}"  required/>
			                	</div>
			                </div>
			                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-info" style="font-size:14px;" id="membertype3"></span>
			                </div>
		                </div>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户姓名</span>
				            		<input class="form-control" id="passengerName3"  type="text" value="${zhuanOrder.passengerName}"  required/>
			                	</div>
			                </div>
			                <div class="col-sm-3" style="padding-left:0px;margin-top:5px;">
			                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual3">0元</span>
			                </div>
		                </div>
		                <@shiro.isMainCompany>
						<div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">所属公司</div>
					            	<select class="form-control" id="companyId3" />
					            		<#list companys as c>
					            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
					            		</#list>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                	</@shiro.isMainCompany>
	                	<div class="form-group">
        					<div class="col-sm-12">
			                    <div class="input-group">
			                    	<span class="input-group-addon start">预约地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="startAddress3"  type="text" value="${zhuanOrder.startAddress}" autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-startAddress3">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
                		<div class="form-group">
        					<div class="col-sm-12">
			                    <div class="input-group">
			                    	<span class="input-group-addon start" >目的地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="endAddress3"  value="${zhuanOrder.endAddress?if_exists}" type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-endAddress3">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
		                
		               <div class="form-group endTime"> 
				            <div class='col-sm-12'>
				               <div class='input-group'>
			               			  <span  class="input-group-addon">预约时间</span>
				                      <input class='form-control' id="serverTime3"  type='text' value="${zhuanOrder.serverTime?string('yyyy-MM-dd HH:mm')}"   required/>
				                      <span  class="add-on"><i class="icon-calendar"></i></span>
				               </div>
				            </div>
					   </div>
					   <div class="form-group" id="flightNo_div" style="display:none">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">航班编号</span>
				            		<input class="form-control" id="flightNo"  type="text" value=""  required/>
			                	</div>
			                </div>
		               </div>
		               <div class="form-group"  id="trainNo_div" style="display:none">
	                    	<div class="col-sm-12">
		                    	<div class="input-group">
			                    	<span class="input-group-addon">车次编号</span>
				            		<input class="form-control" id="trainNo"  type="text" value=""  required/>
			                	</div>
			                </div>
		                </div>
					    <div class='form-group col-sm-12' style="margin-top:10px;display:none;">
					     		<span id="priceText" style="width:100%; position:absolute; bottom:0; text-align:center;"></span>
					    </div>
					    <div id="carTypes_div">
					    <#if carTypes??>
					    	<#list carTypes as carType>
						 	<div class="form-group">
			                    <div class="col-sm-6">
			                    	<div class="input-group carType_div" carTypeId="${carType.id?if_exists}">
				                    	<span  class="input-group-addon">${carType.typeName?if_exists}</span>
					                    <input class='form-control carNumber'  type='number' min='0' ></input>
					                    <span class="input-group-addon">辆</span>
				                	</div>
			                	</div>
			                	<div class="col-sm-6">
			                		<div class="input-group">
			                			<span  class="input-group-addon">车型预计</span>
		                			 	<input class='form-control yuguMoney' type='text'/>
		                			 	<span class="input-group-addon">元</span>
				                	</div>
				                </div>
		                	</div>
		                	</#list>
	                	</#if>
					    </div>
					 	<div class="form-group">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 		<div class="col-sm-9 detail">		               
			                  <span id="sumCar_sumMoney"></span>
			                </div>
		                </div>
		                <div style="margin-top:-30px;">
			                <label class="control-label">用车需求:</label>
			                <div class="form-group">
								<div class="col-sm-12">
									 <textarea class="form-control" cols="30" id='zhuan_memo' name="zhuan_memo" rows="2"></textarea>
								</div>
							 </div>
						 </div>
		                <@shiro.hasPermission name='zhuanCreate'>
	                	<div class="form-group">
			                <div class="col-sm-12">
			                	<input type="button" class="btn btn-primary btn-block" id="zhuanCreate"  value="预约专车"/>
			                </div>
			            </div>
			            </@shiro.hasPermission>
						
					</form>
		    </div>
		  </div>
		</#if>
		<#if default=="freight">
		  <div class="tab-pane in <#if default=="freight">active</#if>" id="freightTab">
	      		<input type="hidden" id="freight_passengerId" value="${freightOrder.passengerId?if_exists}"/>
	      		<input type="hidden" id="freight_startLat" />
	      		<input type="hidden" id="freight_startLng" />
	      		<input type="hidden" id="freight_endLat" />
	      		<input type="hidden" id="freight_endLng" />
	      		<input type="hidden" id="temp_freight_couponId" value="${freightOrder.couponId?if_exists}"/>
	      		<input type="hidden" id="freight_startPrice" value="${freightOrder.preStartPrice?if_exists}"/>
		  		<input type="hidden" id="freight_mileagePrice" value="${freightOrder.premileagePrice?if_exists}"/>
		  		<input type="hidden" id="freight_runTimePrice" value="${freightOrder.prerunTimePrice?if_exists}"/>
		  		<input type="hidden" id="freight_runTime" value="${freightOrder.pretravelTime?if_exists}"/>
		  		<input type="hidden" id="freight_mileage" value="${freightOrder.premileage?if_exists}"/>
		  		<div class="row">
		  			<div class="col-sm-6">
						<div class="panel panel-default">
			  				<div id="freight_allmap" style="z-index: 99999; height:900px;">
							</div>
						</div>
					</div>
					<div class="col-sm-6">
						<form id="submit_form_freight" action="#" class="form-horizontal" method="post">
							<div class="form-group">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
			                    		<span class="input-group-addon">客户电话</span>
					            		<input class="form-control" id="freight_passengerPhone"  type="text" value="${freightOrder.passengerPhone}"  required/>
				                	</div>
				                </div>
				                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
				                	<span class="label label-info" style="font-size:14px;" id="freight_membertype"></span>
				                </div>
			                </div>
			                <div class="form-group">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
			                    		<span class="input-group-addon">客户姓名</span>
					            		<input class="form-control" id="freight_passengerName"  type="text" value="${freightOrder.passengerName}"  required/>
				                	</div>
				                </div>
				                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
				                	<span class="label label-warning" style="font-size:14px;" id="freight_clientVirtual">0元</span>
				                </div>
			                </div>
			                <@shiro.isMainCompany>
			                <div class="form-group">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
				                    	<div class="input-group-addon">所属公司</div>
						            	<select class="form-control" id="freight_companyId" />
						            		<#list companys as c>
						            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
						            		</#list>
						            	</select>
				                	</div>
				                </div>
		                	</div>
		                	</@shiro.isMainCompany>
		                	<div>
		                	   <span>第一个途径地为起始地<font color="red">(不能删除)</font>最后一个为目的地<font color="red">(不能删除)</font></span>
		                	</div>
		                	<div class="form-group zj_wayAddress" id="zj_start">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
			                    		<span class="input-group-addon">起始地址</span>
					            		<input class="form-control zj_waypointAddress" id="freight_startAddress" onfocus="showData(this)" zj_index="0" zj_waypointLng="" zj_waypointLat="" type="text" value=""  required/>
				                	</div>
				                	<div class="show"><font style="font-size:10px"> 联系人:<span class="showContacts"></span></font> <font style="font-size:10px">联系电话:<span class="showPhone"></span></font></div>
				                	<div class="col-sm-12" style="display:none;">
				                        <div class="input-group col-sm-12">
				                    	   <span class="input-group-addon">联系人员</span>
						            	  <input class="form-control zj_waypointContacts" />
					                	</div>
					                </div>
					                 <div class="col-sm-12" style="display:none;">
				                        <div class="input-group col-sm-12">
				                    	   <span class="input-group-addon">联系电话</span>
						            	   <input class="form-control zj_waypointPhone" required/>
					                	</div>
					                </div>
				                </div>
			                </div>
		                	<#--
		                	<div class="form-group zj_wayAddress" id="zj_start">
			                    <div class="col-sm-9">
			                        <div class="panel panel-default">
			                           <div class="panel-body">
		                                    <div class="col-sm-12">
						                        <div class="input-group col-sm-12">
						                    		<span class="input-group-addon">起始地址</span>
								            		<input class="form-control zj_waypointAddress" onblur='position(this)' zj_index="0" zj_waypointLng="" zj_waypointLat="" id="freight_startAddress">
							                	</div>
							                </div>
							                <br/>
							                <br/>
							                <div class="col-sm-12">
						                        <div class="input-group col-sm-12">
						                    	   <span class="input-group-addon">联系人员</span>
								            	  <input class="form-control zj_waypointContacts" />
							                	</div>
							                </div>
							                <br/>
							                <br/>
							                <div class="col-sm-12">
						                        <div class="input-group col-sm-12">
						                    	   <span class="input-group-addon">联系电话</span>
								            	   <input class="form-control zj_waypointPhone" required/>
							                	</div>
							                </div>
			                           </div>
			                         </div>
			                     </div>
	                        </div> -->
	                        <div id="zj_waypointItem">
	                          
				            </div>
				            <div class="form-group zj_wayAddress" id="zj_end">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
			                    		<span class="input-group-addon">目的地址</span>
					            		<input class="form-control zj_waypointAddress" id="zj_destination" onfocus="showData(this)" zj_index="1" zj_waypointLng="" zj_waypointLat="" type="text" value=""  required/>
				                	</div>
				                	<div class="show"><font style="font-size:10px"> 联系人:<span class="showContacts"></span></font> <font style="font-size:10px">联系电话:<span class="showPhone"></span></font></div>
				                	<div class="col-sm-12" style="display:none">
				                        <div class="input-group col-sm-12">
				                    	   <span class="input-group-addon">联系人员</span>
						            	    <input class="form-control zj_waypointContacts" id="zj_contacts"/>
					                	</div>
					                </div>
					                <div class="col-sm-12" style="display:none">
				                        <div class="input-group col-sm-12">
				                    	   <span class="input-group-addon">联系电话</span>
						            	    <input class="form-control zj_waypointPhone" id="zj_phone" required/>
					                	</div>
					                </div>
				                </div>
				                <div class="col-sm-2" style="margin-left:-13px;">
			                      <!--  <label><img  src="${ctx}/assets/css/images/icon_plus.png"class="waypointIcon addAddress" style="cursor:pointer;" title="添加途径地"/></label>-->
			                       <label><span class="glyphicon glyphicon-plus zj_waypointIcon zj_addAddress" style="cursor:pointer;" title="添加途径地" id="zj_addAddress"></span></label>
			                     </div>
			                </div>
	                        <#-- <div class="form-group zj_wayAddress" id="zj_end">
			                    <div class="col-sm-9">
			                        <div class="panel panel-default">
			                           <div class="panel-body" style="padding:2 0 2 0;">
		                                    <div class="col-sm-12">
						                    	<div class="input-group col-sm-12">
						                    		<span class="input-group-addon">最终地址</span>
								            		 <input class="form-control zj_waypointAddress" zj_onblur='position(this)' zj_index="1"  zj_waypointLng=""  zj_waypointLat="" id="zj_destination">
							                	</div>
							                </div>
							                <br/>
							                <br/>
							                <div class="col-sm-12">
						                        <div class="input-group col-sm-12">
						                    	   <span class="input-group-addon">联系人员</span>
								            	    <input class="form-control zj_waypointContacts" id="zj_contacts"/>
							                	</div>
							                </div>
							                <br/>
							                <br/>
							                <div class="col-sm-12">
						                        <div class="input-group col-sm-12">
						                    	   <span class="input-group-addon">联系电话</span>
								            	    <input class="form-control zj_waypointPhone" id="zj_phone" required/>
							                	</div>
							                </div>
			                           </div>
			                         </div>
			                     </div>
			                     <div class="col-sm-2" style="margin-left:-13px;">
			                       <!-- <label><img  src="${ctx}/assets/css/images/icon_plus.png"class="waypointIcon addAddress" style="cursor:pointer;" title="添加途径地"/></label>
			                       <label><span class="glyphicon glyphicon-plus zj_waypointIcon" style="cursor:pointer;" id="zj_addAddress" title="添加途径地"></span></label>
			                     </div>
	                        </div> -->
	                        <div class="form-group">
				                <div class="col-sm-9">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">预约时间</span>
					            	    <input class="form-control inputTime" id="freight_startTime" value="${freightOrder.startTime?string("yyyy-MM-dd HH:mm")}" required/>
				                	</div>
				                </div>
		                	</div>
							 <div class="form-group">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
				                    	<div class="input-group-addon">货车类型</div>
						            	<select class="form-control" id="freight_truckTypeId" />
						            		<#if truckTypes??>
												<#list truckTypes as truckType>
													<option value="${truckType.id}" <#if freightOrder.truckType??&&freightOrder.truckTypeId==truckType.id>selected="selected"</#if>>${truckType.typeName?if_exists}<#if truckType.cangointotown>--入城</#if></option>
												</#list>
											</#if>
						            	</select>
				                	</div>
				                </div>
		                	</div>
		                	<div class="form-group" id="freight_couponInput" style="display:none">
			                    <div class="col-sm-9">
			                    	<div class="input-group">
				                    	<div class="input-group-addon">可用优惠券</div>
						            	<select class="form-control" id="freight_couponId" />
						            		
						            	</select>
				                	</div>
				                </div>
		                	</div>
			                <div class="form-group">
				                <div class="col-sm-9">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">预估金额</span>
					            	    <div class="input-group">
								          <input class="form-control" id="freight_budgetPay" type="number" min="0" value="${freightOrder.budgetPay?if_exists}" />
							      		  <span class="input-group-addon">元</span>
							      		</div>
				                	</div>
				                </div>
		                	</div>
			<@shiro.hasPermission name='freightOrderFixPrice'>
                            <div class="form-group">
                                <label><em>&nbsp;&nbsp;</em>订单定价</label>
                                <label>
                                    <input id="freightfixPrice" name="fixPrice" <#if freightOrder.fixedPrice?? && freightOrder.fixedPrice> checked </#if> type="checkbox">
                                </label>
                            </div>
                            <div id="freightfixPrice_div" style="display: <#if freightOrder.fixedPrice>block<#else>none</#if>;">
                                <div class="form-group">
                                    <div class="col-sm-9">
                                        <div class="input-group">
                                            <span class="input-group-addon">定价金额</span>
                                            <input class="form-control" id="freightfixPriceMoney" name="fixPriceMoney" value="${freightOrder.fixPriceMoney?if_exists}" type="number" min="0" required="">
                                            <span class="input-group-addon">元</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
				</@shiro.hasPermission>
		                	<div class="form-group">
			                  <div class="input-group" >
								 	<ul class="dowebok">
										<li><input type="checkbox" name="zj_flitting"  data-labelauty="搬运" <#if freightOrder.flitting>checked=checked</#if>></li>
										<li><input type="checkbox" name="zj_receipt"  data-labelauty="回单" <#if freightOrder.receipt>checked=checked</#if>></li>
										<li><input type="checkbox" name="zj_receivedPay"   data-labelauty="回款" <#if freightOrder.receivedPay>checked=checked</#if>></li>
										<li style="position:relative;top:-5px;left:0px;<#if freightOrder.receivedPay>display:inline-block<#else>display:none</#if>;" class="zj_receivedPay">
										     <input class="form-control" placeholder="金额" type="number" min="0" id="zj_payMount" name="zj_payMount" max="100000" style="width:80px;" value="${freightOrder.payMount?if_exists}"/>
									 	     <span class="input-group-addon" style="height:34px;margin-top:50px;">元</span>
										</li>
									</ul>
								</div>
			                </div>
			                <div class="form-group" style="margin-top:-35px;">
						 	 	<div class="col-sm-3">
			            	 	</div>
						 		<div class="col-sm-9 detail">	
				                  <span class="freight_mileage">预计时间:${freightOrder.pretravelTime?if_exists}分钟</span>&nbsp&nbsp<span class="freight_runTime">预计路程:${freightOrder.premileage?if_exists}公里	              </span>
				                </div>
			                </div>
			                <div style="margin-top:-35px;">
			                <label class="control-label">订单备注:</label>
			                <div class="form-group">
								<div class="col-sm-9">
									 <textarea class="form-control" cols="20" id='freight_orderMemo' name="memo" rows="4" value="">${freightOrder.memo?if_exists}</textarea>
								</div>
							 </div>
							 </div> 
							 <div class="form-group">
						 	 	<div class="col-sm-3">
			            	 	</div>
						 	 	<div class="col-sm-9">
						 	 	  <@shiro.hasPermission name='freightCreate'>
			                 	  <input  type="button" class="btn btn-primary" id="freight_saveOrder" value="预约"/>
							      </@shiro.hasPermission>
							      <button type="button"  class="btn btn-default" id="freight_close_modal">取消</button>
						        </div>
					        </div>
					        <div class="form-group">
						        <div class="col-sm-9  table-responsive">
						        		<table id="freight_drivers-table" class="table table-condensed table-bordered">
											<tr style="font-size:15px;">
												<th>#</th>
												<th>员工姓名</th>
												<th>驾驶车辆</th>
												<th>距离(公里)</th>
											</tr>
											<tbody id="freight_tbodyId">
											
											</tbody>
										</table>
								</div>
							</div>
						</form>
					</div>
		  		</div>
		  		
			</div>
		
		
		
		
		</#if>
		<#if default="zhuanxian">
		<div class="tab-pane in <#if default=="zhuanxian">active</#if>" id="zhuanxianTab">
      		<input type="hidden" id="zhuanxian_passengerId" value="${zhuanxianOrder.passengerId?if_exists}"/>
      		<input type="hidden" id="zhuanxian_startLat"/ value="${zhuanxianOrder.startLat?if_exists}">
      		<input type="hidden" id="zhuanxian_startLng" / value="${zhuanxianOrder.startLng?if_exists}">
      		<input type="hidden" id="zhuanxian_endLat" value="${zhuanxianOrder.endLat?if_exists}"/>
      		<input type="hidden" id="zhuanxian_endLng" value="${zhuanxianOrder.endLng?if_exists}"/>
      		<input type="hidden" id="zhuanxian_startPrice" value="${zhuanxianOrder.startPrice?if_exists}"/>
	  		<input type="hidden" id="zhuanxian_mileagePrice" value="${zhuanxianOrder.mileagePrice?if_exists}"/>
	  		<input type="hidden" id="zhuanxian_runTimePrice" value="${zhuanxianOrder.runTimePrice?if_exists}"/>
	  		<input type="hidden" id="zhuanxian_runTime" value="${zhuanxianOrder.runTime?if_exists}"/>
	  		<input type="hidden" id="zhuanxian_mileage" value="${zhuanxianOrder.mileage?if_exists}"/>
	  		<input type="hidden" id="zhuanxian_employId" value="${zhuanxianOrder.employId?if_exists}"/>
	  		<div class="row">
	  			<div class="col-sm-6">
					<div class="panel panel-default">
		  				<div id="zhuanxian_allmap" style="z-index:8888; height:700px;">
						</div>
					</div>
				</div>
				
				<div class="col-sm-6">
					<div class="panel panel-default">
							<div class="panel-heading">
								<ul class="nav nav-tabs navigation" id="zhuanxian_orderType" style="margin-left:30px;cursor:default;">
								 <li <#if zhuanxianOrder??&&zhuanxianOrder.orderType??&&zhuanxianOrder.orderType==0>class="active" </#if> val="0"><a id="" href="#" data-toggle="tab">拼车</a></li>
								 <li <#if zhuanxianOrder??&&zhuanxianOrder.orderType??&&zhuanxianOrder.orderType==1>class="active"</#if> val="1"><a  href="#" data-toggle="tab">包车</a></li>
								 <li <#if zhuanxianOrder??&&zhuanxianOrder.orderType??&&zhuanxianOrder.orderType==2>class="active"</#if>  val="2"><a  href="#" data-toggle="tab">寄货</a></li>
								</ul>
						    </div>
					   <div class="panel-body">
					
					<form id="submit_form_zhuanxian" action="#" class="form-horizontal" method="post">
						<div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户电话</span>
				            		<input class="form-control" id="zhuanxian_passengerPhone"  type="text" value="${zhuanxianOrder.passengerPhone?if_exists}" required/>
			                	</div>
			                </div>
			                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-info" style="font-size:14px;" id="zhuanxian_membertype"></span>
			                </div>
		                </div>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户姓名</span>
				            		<input class="form-control" id="zhuanxian_passengerName"  type="text" value="${zhuanxianOrder.passengerName?if_exists}"  required/>
			                	</div>
			                </div>
			                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-warning" style="font-size:14px;" id="zhuanxian_clientVirtual">0元</span>
			                </div>
		                </div>
		               <@shiro.isMainCompany>
		                <div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">所属公司</div>
					            	<select class="form-control" id="zhuanxian_companyId" value="${zhuanxianOrder.companyId?if_exists}"/>
					            		<#list companys as c>
					            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
					            		</#list>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                   </@shiro.isMainCompany>
                        <div class="form-group">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon" id="zhuanxian_startTime_text">预约时间</span>
				            	    <input class="form-control inputTime" id="zhuanxian_startTime"  value="${.now?string("yyyy-MM-dd HH:mm")}" required/>
			                	</div>
			                </div>
	                	</div>
						 <div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">线&emsp;&emsp;路</div>
					            	<select class="form-control" id="lineId" value="${zhuanxianOrder.lineId?if_exists}"/>
					            		<#if lines??>
											<#list lines as line>
												<option value="${line.id}" <#if zhuanxianOrder.lineId==line.id>selected="selected"</#if> startcity="${line.startCity}" startaddress="${line.startAddress?if_exists}" jihuoareaid="${line.jihuoAreaId?if_exists}" baocheareaid="${line.baocheAreaId?if_exists}" pingcheareaid="${line.areaId?if_exists}" endcity="${line.endCity}" endaddress="${line.endaddress?if_exists}" >${line.name?if_exists}</option>
											</#list>
										</#if>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                	<div class="form-group" id="zhuanxian_peopleNumber_div">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon" id="zhuanxian_peopleNumber_text">乘车人数</span>
							          <input class="form-control" id="zhuanxian_peopleNumber" maxlength="10000" type="number" min="1" value="<#if zhuanxianOrder??&&zhuanxianOrder.orderType??&&zhuanxianOrder.orderType==1>1<#else>${zhuanxianOrder.peopleNumber!1}</#if>" />
						      		  <span class="input-group-addon" id="zhuanxian_peopleNumber_text_addon">位</span>
						      		
			                	</div>
			                </div>
	                	</div>
	                	<div class="form-group">
        					<div class="col-sm-11">
			                    <div class="input-group">
			                    	<span class="input-group-addon start">预约地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="zhuanxianStartAddress"  type="text" value="${zhuanxianOrder.startAddress?if_exists}" autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-zhuanxianStartAddress">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
	                	<div class="form-group">
        					<div class="col-sm-11">
			                    <div class="input-group">
			                    	<span class="input-group-addon end" >目的地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="zhuanxianEndAddress" value="${zhuanxianOrder.endAddress?if_exists}" type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-zhuanxianEndAddress">定位</button>
				                    </span>
			                    </div>
			                </div>
			                 <div class="col-sm-1" style="margin-left:-20px;margin-top:-30px;" id="zhuanxian_wanghuan">
			                  <a href="#"><img src="${ctx}/assets/img/returnBack.png"></a>
			                </div>
		                </div>
		                <div class="form-group" id="zhuanxianTakeDelivery_div" style="display:<#if zhuanxianOrder??&&zhuanxianOrder.orderType==2>block;<#else>none;</#if>">
		                    <div class="col-sm-6">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">收货人姓名</span>
				            		<input class="form-control" id="zhuanxian_takeDeliveryName"  type="text" value="${zhuanxianOrder.takeDeliveryName?if_exists}"  required/>
			                	</div>
			                </div>
		                    <div class="col-sm-6">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">收货人电话</span>
				            		<input class="form-control" id="zhuanxian_takeDeliveryPhone"  type="text" value="${zhuanxianOrder.takeDeliveryPhone?if_exists}"  required/>
			                	</div>
			                </div>
		                </div>
	                	<div class="form-group" id="zhuanxiancouponInput" style="display:none">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">可用优惠券</div>
					            	<select class="form-control" id="zhuanxian_couponId" >
					            		
					            	</select>
			                	</div>
			                </div>
	                	</div>
		                <div class="form-group">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon">预计金额</span>
				            	    <div class="input-group">
							          <input class="form-control" id="zhuanxian_budgetPay" maxlength="10000"  type="number" min="0" />
						      		  <span class="input-group-addon">元</span>
						      		</div>
			                	</div>
			                </div>
	                	</div>
		                <div class="form-group" style="margin-top:-35px;">
					 	 	
					 		<div class="col-sm-12 detail">				               
			                  <span class="zhuanxian_mileage"></span>&nbsp&nbsp<span class="zhuanxian_runTime"></span>
			                </div>
		                </div>
		                <div style="margin-top:-10px;">
		                <label class="control-label">订单备注:</label>
		                <div class="form-group">
							<div class="col-sm-12">
								 <textarea class="form-control" cols="20" id='zhuanxian_orderMemo' name="memo" rows="4" >${zhuanxianOrder.memo?if_exists}</textarea>
							</div>
						 </div>
						 </div> 
						 <div class="form-group">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 	 	<div class="col-sm-12">
					 	 	  <@shiro.hasPermission name='zhuanxianCreate'>
		                 	  <input  type="button" class="btn btn-primary btn-block" id="zhuanxian_saveOrder" value="预约"/>
		                 	  </@shiro.hasPermission>
					        </div>
				        </div>
				  	 <div class="form-group">
					        <div class="col-sm-12  table-responsive">
					        		<table id="zhuanxian_drivers-table" class="table table-condensed table-bordered">
										<tr style="font-size:15px;">
											<th>#</th>
											<th>员工姓名</th>
											<th>驾驶车辆</th>
											<th>距离(公里)</th>
										</tr>
										<tbody id="zhuanxian_tbodyId">
										
										</tbody>
									</table>
							</div>
						</div>
					</form>
					</div>
					</div>
				</div>
	  		</div>
	  		
		</div>
		
		</#if>
		
		<#if default=="paotui">
		<div class="tab-pane active" id="errandTab">
			<div class="row">
				<form id="submit_form2" action="#" class="form-horizontal" method="post">
		  			<input type="hidden" id="startLat" <#if errand??> value="${errand.startLat?if_exists}"</#if>/>
				  	<input type="hidden" id="startLng" <#if errand??> value="${errand.startLng?if_exists}"</#if>/>
		  			<input type="hidden" id="deliverLat" <#if errand??> value="${errand.deliverLat?if_exists}"</#if>/>
			  		<input type="hidden" id="deliverLng" <#if errand??> value="${errand.deliverLng?if_exists}"</#if>/>
			  		<input type="hidden" id="passengerId" <#if errand??> value="${errand.passengerId?if_exists}"</#if>/>
			  		<input type="hidden" id="companyName" <#if errand??> value="${errand.companyName?if_exists}"</#if>/>
	  				<input type="hidden" id="startPrice" <#if errand??> value="${errand.startPrice?if_exists}"</#if>/>
			  		<input type="hidden" id="mileagePrice" <#if errand??> value="${errand.mileagePrice?if_exists}"</#if>/>
			  		<input type="hidden" id="travelTimePrice" <#if errand??> value="${errand.travelTimePrice?if_exists}"</#if>/>
			  		<input type="hidden" id="travelTime" <#if errand??> value="${errand.travelTime?if_exists}"</#if>/>
			  		<input type="hidden" id="mileage" <#if errand??> value="${errand.mileage?if_exists}"</#if>/>
		  			<input type="hidden" id="weightPrice" <#if errand??> value="${errand.weightPrice?if_exists}"</#if>/>
		  			<div class="col-md-6">
						<div class="panel panel-default">
			  				<div id="allmap2" style="z-index: 99999; height:700px;">
							</div>
						</div>
					</div>
					<div class="col-md-6">
						<div class="panel panel-default">
							<div class="panel-heading">
								<ul class="nav nav-tabs navigation" id="title" style="margin-left:30px;cursor:default;">
						            </ul>
						    </div>
					    	<div class="panel-body">
					    		 <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户手机</span>
						            		<input class="form-control" id="passengerPhone"  type="text" <#if errand??> value="${errand.passengerPhone?if_exists}" </#if> required/>
					                	</div>
					                </div>
					                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-info" style="font-size:14px;" id="membertype2"></span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户姓名</span>
					            			<input class="form-control" id="passengerName"  type="text" <#if errand??> value="${errand.passengerName?if_exists}" </#if> required/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual2">0元</span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<div class="input-group-addon">所属公司</div>
							            	<select class="form-control" id="companyId2" />
							            		<#list companys as c>
							            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
							            		</#list>
							            	</select>
					                	</div>
					                </div>
				                </div>
				                 <div class="form-group">
				                    <div class="col-sm-12" id="imgs" >
											
											<div class="row">
												<div class="col-sm-6">
												<span class="help-block">建议图片大小400x400</span>
												 
												</div>
												<div class="col-sm-3" >
												<button  type="button"  class="button button-pill button-flat-primary button-tiny" id="shareImage_btn">
													<i class="glyphicon glyphicon-open" ></i>添加图片</button>
												</div>
												<div class="col-sm-3">
												<button  type="button"  id="deleteImg" class="pull-right button button-pill button-flat-caution button-tiny">
									        		<i class="glyphicon glyphicon-remove" ></i>删除图片</button>
									        	</div>
											</div>
											<input style="display:none;" type="file" name="imgFile" id="shareImage_file" accept=".bmp,.gif,.jpeg,.jpg,.png" />
										    
										   
										  <#if errand.imglist??>
									         <#assign imgs="">
									        <#list errand.imglist as img>
									          	<#if imgs=="">				          
									              <#assign imgs=imgs+img.oldImg+'-'+img.smallImg>
									              <#elseif imgs!=""><#assign imgs=imgs+','+img.oldImg+'-'+img.smallImg>
									            </#if>
									          <img src="${ctx}/${img.smallImg}" class='img' style="margin-right:0px;"></img>
									        </#list>										      
										  </#if> 
										     <input type="hidden" name="imgs" id="imgsUrl" value="<#if imgs??>${imgs}</#if>"/> 
										</div>
							        </div>
				                <div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon startAddress">输入地址</span>
						                    <input placeholder="附近的小区/街道/建筑物/商圈" class="form-control autoComplete" id="startAddress"  type="text" index="0" lng="${errand.startLng?if_exists}" lat="${errand.startLat?if_exists}" value="${errand.startAddress?if_exists}"  autocomplete="off" required/>
						                    <span class="input-group-btn">
					                            <button class="btn btn-default btn-Address" type="button">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
				                <div class="form-group">
					                    	<div class="col-sm-12">
						                    	<div class="input-group">
						                    		<span class="input-group-addon">详细起点</span>
								            		<input class="form-control" id="startDetailedAddress"  type="text" value="${errand.startDetailed?if_exists}"  required/>
							                	</div>
							                </div>
						                </div>
				                <div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon deliverAddress">输入地址</span>
						                    <input placeholder="附近的小区/街道/建筑物/商圈" class="form-control autoComplete" id="deliverAddress"  type="text"  value="${errand.deliverAddress?if_exists}" index="1" lng="${errand.deliverLng?if_exists}" lat="${errand.deliverLat?if_exists}" autocomplete="off" required/>
						                    <span class="input-group-btn">
					                            <button class="btn btn-default btn-Address" type="button" id="">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
				                <div class="form-group">
					                    	<div class="col-sm-12">
						                    	<div class="input-group">
						                    		<span class="input-group-addon">详细终点</span>
								            		<input class="form-control" id="deliverDetailedAddress"  type="text" value="${errand.endDetailed?if_exists}"  required/>
							                	</div>
							                </div>
						                </div>
						        <div class="form-group">
				                	<div class='col-sm-12'>
							        		<div class='input-group'>
						                 	<span class='input-group-addon'>商品金额</span>
						                 	<input class='form-control' id='goodsCash'  type="number" min="0" value="${errand.goodsCash?if_exists}" number required/>
						                 	</div>
					                </div>
					            </div>
					            <div class="form-group">
				                	<div class='col-sm-12'>
							        		<div class='input-group'>
						                 	<span class='input-group-addon'>商品重量</span>
						                 	<input class='form-control' id='weight'  type="number" min="0" value="${errand.weight?if_exists}"  required/>
						                 	</div>
					                </div>
					            </div>
					            <div class="form-group">
				                	<div class='col-sm-12'>
							        		<div class='input-group'>
						                 	<span class='input-group-addon'>感谢费用</span>
						                 	<input class='form-control' id='thanksCash' value="${errand.thanksCash?if_exists}" type="number" min="0" required/>
						                 	</div>
					                </div>
					            </div>
					            <div class="form-group">
				                	<div class='col-sm-12'>
							        		<div class='input-group'>
						                 	<span class='input-group-addon'>保价金额</span>
						                 	<input class='form-control' id='protectPrice'  type="number" min="0" value="${errand.protectPrice?if_exists}"  required/>
						                 	</div>
					                </div>
					            </div>
					            <div class="form-group">
				                	<div class='col-sm-2'>
				                		<span class="help-block">附加服务</span>
				                	</div>
							        <div class="col-sm-10">
					                    	<div class="checkbox"  id="otherServices" value="${errand.addservices?if_exists}">
								                	  	
						                	</div>
						                </div>
					            </div>
				                <div class="form-group">
					                    <div class="col-sm-6">
					                    	<div class="input-group">
								             <span class="input-group-addon" id="valuationType_zj"></span>
									         <input class="form-control" id="shouldPay" name="shouldPay" type="number" min="0" value="<#if errand.shouldPay??>${errand.shouldPay}</#if>" required/>
								      		 <span class="input-group-addon">元</span>
								      		 </div>
						                </div>
						                <div class="col-sm-6">
				                    	<div class="input-group">
				                    		<span class="input-group-addon startTime">预约时间</span>
						            		<input class="form-control" id="startTime"  type="text" <#if errand??> value="${errand.startTime?string('yyyy-MM-dd HH:mm')}" </#if>  required/>
					                	</div>
					                </div>
					            </div>
					             <div class="form-group" id="errand_couponInput" style="display:none">
					                    <div class="col-sm-12">
					                    	<div class="input-group">
						                    	<div class="input-group-addon">可用优惠券</div>
								            	<select class="form-control" id="errand_couponId" />
								            		
								            	</select>
						                	</div>
						                </div>
				                </div>
				                <div class="form-group">			
					                <div class="col-sm-3">
				            	 	</div>             
						            <div class="col-sm-9 detail">				               
						                 <span class="errand_mileage"><#if errand??&&errand.mileage!=0>预计路程:${errand.mileage}公里</#if></span>&nbsp&nbsp<span class="errand_travelTime"><#if errand??&&errand.travelTime!=0>预计时间:${errand.travelTime}分钟</#if></span>
					                </div>
				                </div>
				                <div class="form-group">
				                		<div class="col-sm-12">
					                    	<label class="control-label">任务内容</label>
				                		</div>
								</div>
								<div class="form-group">
				                    <div class="col-sm-12">
				                    	<textarea class="form-control" cols="60"  id="content" rows="4"><#if errand??>${errand.content?if_exists}</#if></textarea>
					                </div>
				                </div>
				                <@shiro.hasPermission name='errandCreate'>
		  						<div class="form-group">
					                <div class="col-sm-12">
					                	<input type="button" class="btn btn-primary btn-block" id="errandCreate" value="呼叫跑腿"/>
					                </div>
					            </div>
					            </@shiro.hasPermission>
					            
						    </div>
					    </div>
				    </div>
		  		</form>
		  	</div>
		</div>
		</#if>
		
	</div>
</div>
  </div>
<#--货运-->
	<div class="modal fade" id="myModal" style="margin-left:588px;margin-top:187px;width:360px;z-index:3" >
	  <div class="modal-dialog">
	    <div class="modal-content" style="width:360px;">
	      <div class="modal-body" >
	         <div style="width:300px;">
		        <div class="input-group " style="">
					<span class="input-group-addon">详细地址</span>
					<input class="form-control" placeholder="附近标志性建筑物/街道/商圈" waypointLng="" waypointLat=""  id="tempAddress"/>
				</div>
				<br/>
				<div >
					<div class="input-group col-sm-12">
					   <span class="input-group-addon">联系人员</span>
					  <input class="form-control " id="tempContacts"/>
					</div>
				</div>
				<br/>
				<div >
					<div class="input-group col-sm-12">
					   <span class="input-group-addon">联系电话</span>
					   <input class="form-control " id="tempPhone" required/>
					</div>
				</div>
				<center style="margin-top:10px;">
					<button type="button" class="btn btn-default colse">确定</button>
					<button type="button" class="btn btn-default colse">取消</button>
				</center>
	        </div>
	      </div>
	    </div><!-- /.modal-content -->
	  </div><!-- /.modal-dialog -->
	</div><!-- /.modal-->
<script type="text/javascript" language="javascript">
    var isMain = false;
     <@shiro.isMainCompany>
        isMain = true;
     </@shiro.isMainCompany>
	window.daijia = {ctx : '${ctx?if_exists}', lng : '${lng?if_exists}', lat : '${lat?if_exists}'};
    var type="${default}";
    <#if default=="zhuanxian">
    var zhuanxian_lineId = ${zhuanxianOrder.lineId?if_exists};
    </#if>
    <#if default=="paotui">
    var orderType=${errand.orderTypeId?default(-1)};
    var addServices ="${errand.addServices?if_exists}";
    </#if>
    <#if default=="freight">
	    <#if freightOrder.receivedPay>
	      var zj_receivedPay=true;
	    <#else>
	      var zj_receivedPay=false;
	    </#if>
	    <#if freightOrder.receipt>
	      var zj_receipt=true;
	    <#else>
	      var zj_receipt=false;
	    </#if>
	    <#if freightOrder.flitting>
	      var zj_flitting=true;
	    <#else>
	      var zj_flitting=false;
	    </#if>
		  var waypos = [];
		  <#list waypoints as way >
		   var obj = new Object();
		   obj.lng=${way.lng};
		   obj.lat=${way.lat};
		   obj.address="${way.address}";
		   obj.contacts="${way.contacts}";
		   obj.phone="${way.phone}";
		   obj.sequence=${way.sequence};
		   waypos[waypos.length] = obj ;
		  </#list>
    </#if>
</script>
<script src="${ctx}/assets/js/jquery-1.11.0.min.js"></script>
<script src="${ctx}/assets/js/bootstrap.min.js"></script>
<script src="${ctx}/assets/js/sco.modal.js"></script>
<script src="${ctx}/assets/js/sco.message.js"></script>
<script src="${ctx}/assets/js/sco.confirm.js"></script>
<script src="//api.map.baidu.com/api?v=2.0&ak=AuNk3YS21DSmHEEvIFDf9dbD" type="text/javascript"></script> 
<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" type="text/javascript"></script>
<script src="${ctx}/assets/js/RichMarker_min.js" type="text/javascript"></script>
<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/jquery.autocomplete.min.js"></script>
<script src="${ctx}/assets/js/freight/jquery-labelauty.js"></script>
<#if default=="paotui">
	<script src="${ctx}/assets/js/errand/addmoreup.js"></script>
</#if>
<#if default=="zhuan">
	<script src="${ctx}/assets/js/zhuanche/addmore.js"></script>
</#if>
<#if default=="freight">
	<script src="${ctx}/assets/js/freight/addmore.js"></script>
</#if>
<#if default=="zhuanxian">
	<script src="${ctx}/assets/js/zhuanxian/addmore.js"></script>
</#if>

<script type="text/javascript">
$('.dowebok input[type=checkbox]').labelauty();
<#if message??>
	$.scojs_message("${message}", $.scojs_message.TYPE_ERROR);
</#if>
var map = null; //地图对象
var isfirst=true;//地图第一次加载
var driving2=null;//规划路线的对象
var start_Point = new Array();
var end_Point = new Array();

function initialize(){
	var point=new BMap.Point(${lng},${lat});
	
	if (point) {
		map = new BMap.Map("allmap");  
		map.centerAndZoom(point, 13);
	    map.enableScrollWheelZoom();
    	driving2 = new BMap.DrivingRoute(map, {
    			policy : BMAP_DRIVING_POLICY_LEAST_DISTANCE,    
				onSearchComplete: function(results){   
					if (driving2.getStatus() == BMAP_STATUS_SUCCESS){ 
					 // 获取第一条方案   
					 var plan = results.getPlan(0); 
					 var distance=plan.getDistance();
					 var timeStr=plan.getDuration();
					 $.post("${ctx}/order/getPrice",
						   {'passengerId':$('#clientId').val(),
						    'companyId':$("#companyId").val(),
						    'time':timeStr,
						    'mileage':distance},function(data){
						    	$("#yuguMoney").val(data.money);
						    	$(".mileage_daijai").text("预计时间:"+data.travelTime+"分钟");
						    	$(".travelTime_daijia").text("预计路程:"+data.mileage+"公里");
						    },"json");
					}
				},
				renderOptions: {    //显示到地图上
					map: map,    
					autoViewport: true 
				}  
			});
				
	    //右键菜单
	    var contextMenu = new BMap.ContextMenu();
		var txtMenuItem = [{
		   text:'设为预约地',
		   callback:function(p){
		   		map.clearOverlays();
		   		
		   		var memberMarker = new BMap.Marker(p);  // 创建标注
    			map.addOverlay(memberMarker);
    			
    			markerComplete(p.lng,p.lat);
    			
    			var gc = new BMap.Geocoder();
			    gc.getLocation(p, function(rs){
			        var addComp = rs.addressComponents;
			        $("#fromPlace").val(addComp.street+" "+addComp.streetNumber);
			        $("#fromPlaceDetail").val("");
					if(rs.surroundingPois[0].title.trim()!=null && rs.surroundingPois[0].title.trim()!=""){
						$("#fromPlaceDetail").val(rs.surroundingPois[0].title);
					}
			    });  
			    start_Point[0]=p.lng;
		        start_Point[1]=p.lat;
		        if(end_Point.length!=0){
		        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
					var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
					map.centerAndZoom(startPoint, 10); 
					driving2.search(startPoint, endPoint);
		        }      
		   }
		},{
		   text:'设为目的地',
		   callback:function(p){
		   		map.clearOverlays();
		   		
		   		var memberMarker = new BMap.Marker(p);  // 创建标注
    			map.addOverlay(memberMarker);
    			
    			$("#toPlaceLongitude").val(p.lng);
				$("#toPlaceLatitude").val(p.lat);
    			
    			var gc = new BMap.Geocoder();
			    gc.getLocation(p, function(rs){
			        var addComp = rs.addressComponents;
			        $("#toPlace").val(addComp.street+" "+addComp.streetNumber);
			    	$("#toPlaceDetail").val("");
			        if(rs.surroundingPois[0].title.trim()!=null && rs.surroundingPois[0].title.trim()!=""){
		        	   $("#toPlaceDetail").val(rs.surroundingPois[0].title);
			        }
			    });   
			    end_Point[0]=p.lng;
		        end_Point[1]=p.lat;
		        
		        if(start_Point.length!=0){
		        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
					var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
					map.centerAndZoom(startPoint, 10); 
					driving2.search(startPoint, endPoint);
		        }      
		   }
		}];
		
		for(var i=0; i < txtMenuItem.length; i++){
			contextMenu.addItem(new BMap.MenuItem(txtMenuItem[i].text,txtMenuItem[i].callback,100));
			if(i==1 || i==3) {
				contextMenu.addSeparator();
			}
		}
		map.addContextMenu(contextMenu); 

		//地图加载完毕
		map.addEventListener('tilesloaded',function(){
			if(isfirst){
				isfirst=false;
				<#if order??>
				$("#clientPhone").val('${order.clientPhone?if_exists}');
				<#elseif errand??>
				$("#clientPhone").val('${errand.passengerPhone?if_exists}');
				</#if>
				var val = $("#clientPhone").val();
				if($.trim(val) != ''){
    				$.get('${ctx}/member/findByPhone',{'phone':val,'couponType':'daijia'},function(data){
						if(data.passenger!=null){
							$("#clientId").val(data.passenger.id);
		    				$("#clientName").val(data.passenger.name);
		    				$("#clientVirtual").text(data.passenger.drawMoney+data.passenger.nodrawMoney+"元");
		    				$("#allcount").html(data.countAll);
		    				$("#allnotcancelcount").html(data.countAllNotCancel);
		    				$("#monthcount").html(data.countMonth);
		    				$("#monthnotcancelcount").html(data.countMonthNotCancel);
		    				
		    				$("#couponSelect").html("");
		    				if(null!=data.coupons && data.coupons.length>0){
			    				var contentText="";
			    					contentText+="<div class='input-group'>";
									contentText+="<div class='input-group-addon'>可用优惠券</div>";
									contentText+="<select class='form-control' multiple='multiple' id='couponIds' name='couponIds'/>";
					            	contentText+="</select>";
					            	contentText+="</div>";
				    			$("#couponSelect").append(contentText);
				    			$(data.coupons).each(function(index,element){
					            	var text="<option value="+element.id+">"+element.couponRule.title+"</option>";
					            	$("#couponIds").append(text);
			    				});
			    				$('#couponIds').multiselect({
									enableFiltering: true,
								    includeSelectAllOption: true,
								    selectAllText: '全部',
								    selectAllJustVisible: true,
								    buttonWidth: '100%',
								    nonSelectedText: '请选择优惠券',
								    nSelectedText: ' - 已选择',
								    numberDisplayed: 5,
								    allSelectedText: '已选择全部'
								});
		    				}
    				
		    				if(data.passenger.inBlackList){
		    					$("#membertype").html("黑名单");
		    				}
		    				else{
		    					$("#membertype").html(data.passenger.typeStr);
		    				}
		    				$("#todayordernums_div").slideDown();
						}
						else{
							$("#allcount").html(0);
							$("#allnotcancelcount").html(0);
		    				$("#monthcount").html(0);
		    				$("#monthnotcancelcount").html(0);
		    				$("#clientVirtual").text("0元");
							$("#clientName").val("");
							$("#membertype").html("");
						}
		    				
						if(data.orderList && data.orderList.length>0){
							$(".memberOrders-tr").remove();
							$(data.orderList).each(function(index,element){
		    					var content="<tr class='memberOrders-tr'>";
								if(element.status==0){
									content+="<td><span class='label label-info'>新订单</span></td>";
								}
								else if(element.status==1){
									content+="<td><span class='label label-warning'>已派单</span></td>";
								}
								else{
									content+="<td><span class='label label-danger'>服务中</span></td>";
								}
								content+="<td><a target='_blank' href='${ctx}/order/detail/"+element.id+"'>***"+element.orderNumber.substring(8)+"</a></td>"+
										"<td>"+element.orderType+"</td>"+
										"<td>"+element.fromSource+"</td>"+
										"<td>"+element.serverTimeHI+"</td>"+
										"<td>"+element.fromPlace+"</td>"+
										"<tr>";
								$("#memberOrders-table tbody").append(content);
							});
							
							$("#memberOrders-table").show();
						}
						else{
							$("#memberOrders-table").hide();
						}
		    		});
	    		}
				<#if order??>
					$("#fromPlace").val('${order.fromPlace?if_exists}');
					var oldpoint = new BMap.Point(${order.clientLongitude},${order.clientLatitude});
					
					start_Point[0]=oldpoint.lng;
			        start_Point[1]=oldpoint.lat;

					<#if order.toPlaceLongitude?? && order.toPlaceLatitude??>
			        	end_Point[0]='${order.toPlaceLongitude}';
			        	end_Point[1]='${order.toPlaceLatitude}';
			        	$("#toPlaceLongitude").val('${order.toPlaceLongitude}');
			        	$("#toPlaceLatitude").val('${order.toPlaceLatitude}');
			        	
			        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
						var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
						map.centerAndZoom(startPoint, 10); 
						driving2.search(startPoint, endPoint);
			        <#else>
			        	map.centerAndZoom(oldpoint, 13);
	    				map.addOverlay(new BMap.Marker(oldpoint));
			        </#if>			        
	    			
	    			markerComplete(oldpoint.lng,oldpoint.lat);
	    			
	    			$("#clientId").val('${order.clientId?if_exists}');
	    			$("#clientName").val('${order.clientName?if_exists}');
    			</#if>
    			
			}
		});
    		
	}else{
		$.scojs_message("位置不准确，请重新编辑地区", $.scojs_message.TYPE_ERROR);
	}
	

}

function formCheck(){
	if($("#serverDate").val()=='' || $("#serverTime").val()==''){
		$.scojs_message("服务时间不能为空", $.scojs_message.TYPE_ERROR);
		return false;
	}
	if($("#driverNum").val()==''){
		$.scojs_message("人数不能为空", $.scojs_message.TYPE_ERROR);
		return false;
	}
	if($("#clientPhone").val()==''){
		$.scojs_message("客户手机不能为空", $.scojs_message.TYPE_ERROR);
		return false;
	}
	return true;
}

$(document).ready(function(){
	$("#serverDate").datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
	$("#startTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'day', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
	$("#freight_startTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true,startDate:new Date()});
	$("#serverTime").datetimepicker({ format: 'HH:ii', language: 'zh-CN',minView: 'hour', startView: 'day', pickDate: true, pickTime: true, inputMask: false, autoclose: true,startDate:'${(.now)?string('yyyy-MM-dd')}' });
	$("#zj_serverTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', pickDate: true, pickTime: true, inputMask: false, autoclose: true });
	$("#serverTime3").datetimepicker({format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true ,startDate:'${(.now)?string('yyyy-MM-dd')}'});
	
	$('#serverTime3').change(function(){
		if(!(/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)\s+([01][0-9]|2[0-3]):[0-5][0-9]$/.test($('#serverTime3').val()))){
			$.scojs_message("请输入正确的时间格式,如:2015-12-30 12:30", $.scojs_message.TYPE_ERROR);
			$('#serverTime3').val('');
		}
	});
	initialize();
	//定位
	$("#btn-position").click(function(){
		if($("#fromPlace").val()==''){
			$.scojs_message("请填写预约地", $.scojs_message.TYPE_ERROR);
		}
		else{
			map.clearOverlays();
			var local = new BMap.LocalSearch(map, {
	    	  renderOptions:{map: map, autoViewport:true}
	    	});
		    local.search($("#fromPlace").val());
		    local.setInfoHtmlSetCallback(function(poi,html){
					markerComplete(poi.marker.point.lng,poi.marker.point.lat);
					start_Point[0]=poi.marker.point.lng;
					start_Point[1]=poi.marker.point.lat;
					var title = poi.marker.getTitle();
					var markers = map.getOverlays();
					for(var i=0;i<markers.length;i++){
						markers[i].show();
					}
					if(end_Point.length!=0){
						var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
						var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
						driving2.search(startPoint, endPoint);
						poi.marker.hide(); 
					}
				});
				
		}
	});
	//目的地定位
	$("#btn_toPlace").click(function(){
			if($("#toPlace").val()==''){
				$.scojs_message("请填写目的地", $.scojs_message.TYPE_ERROR);
			}else{
				map.clearOverlays();
				var local = new BMap.LocalSearch(map, {
		    	  renderOptions:{map: map, autoViewport:true}
		    	});

			    local.search($("#toPlace").val());
			    
			    local.setInfoHtmlSetCallback(function(poi,html){
				
					$("#toPlaceLongitude").val(poi.marker.point.lng);
					$("#toPlaceLatitude").val(poi.marker.point.lat);
					end_Point[0]=poi.marker.point.lng;
					end_Point[1]=poi.marker.point.lat;
					var title = poi.marker.getTitle();
					var markers = map.getOverlays();
					for(var i=0;i<markers.length;i++){
						markers[i].show();
					}
					if(start_Point.length!=0){
						var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
						var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
						driving2.search(startPoint, endPoint);
						poi.marker.hide(); 
					}
				});
			
			}
		});
		
	
	//创建订单
	$("#create-order").click(function(){
		if($("#fromPlace").val()=='' || $("#longitude").val()=='' || $("#latitude").val()==''){
			$.scojs_message("请先定位代驾地点", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		var clientPhone=$("#clientPhone").val();
		var isphone=/^\+?\d{3,13}(\-?(\d{6,8}?))?(\-?(\d{4,8}?))*$/; 
		if (!isphone.test(clientPhone)){
			$.scojs_message("客户手机格式不正确", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		if($("#fixPrice").length>0 && $("#fixPrice")[0].checked){
			if($("#fixPriceMoney").val()==""){
				$.scojs_message("请填写定价金额", $.scojs_message.TYPE_ERROR);
				return false;
			}
			var moneyReg=/^(\d+)(.[0-9]{0,1})?$/;
			if(!moneyReg.test($("#fixPriceMoney").val())){
				$.scojs_message("请填写正确的定价金额，如：39.9", $.scojs_message.TYPE_ERROR);
				return false;
			}
		}
		
		var fc=formCheck();
		if(!fc){
			return false;
		}
		
		if($("input[name=check_drivers]:checked").length > 0){
			if($("input[name=check_drivers]:checked").length!=$("#driverNum").val()){
				$.scojs_message("需要选择"+$("#driverNum").val()+"名服务人员", $.scojs_message.TYPE_ERROR);
				return false;
			}
		}
		
		if($("#couponIds option:selected").length>$("#driverNum").val()){
			$.scojs_message("最多选择"+$("#driverNum").val()+"张优惠券", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		issubmit=true;
		
		//禁用按钮
		$("#create-order").attr("disabled",true);
		
		if($("input[name=check_drivers]:checked").length > 0){
			$.post('${ctx}/order/createAndPaidan',$("#submit_form").serialize(),function(result){
				if(result.success){
					window.close();
					window.opener.location.reload(true);
				}
				else{
					$.scojs_message(result.message, $.scojs_message.TYPE_ERROR);
					$("#create-order").attr("disabled",false);
				}
			});
		}
		else{
			$.post('${ctx}/order/create',$("#submit_form").serialize(),function(){
				window.close();
				window.opener.location.reload(true);
			});
		}
		
		
	});
	
	//根据客户手机获取信息
	$("#clientPhone").change(function(){
	    
		$.get('${ctx}/member/findByPhone',{'phone':$(this).val(),'couponType':'daijia'},function(data){
		
			if(data.passenger!=null){
				$("#clientId").val(data.passenger.id);
				$("#clientName").val(data.passenger.name);
				$("#clientPhone").val(data.passenger.phone);
				$("#clientId").val(data.passenger.id);
				$("#clientVirtual").text(data.passenger.drawMoney+data.passenger.nodrawMoney+"元");
				$("#allcount").html(data.countAll);
				$("#allnotcancelcount").html(data.countAllNotCancel);
				$("#monthcount").html(data.countMonth);
				$("#monthnotcancelcount").html(data.countMonthNotCancel);
				
				$("#couponSelect").html("");
				if(null!=data.coupons && data.coupons.length>0){
    				var contentText="";
    					contentText+="<div class='input-group'>";
						contentText+="<div class='input-group-addon'>可用优惠券</div>";
						contentText+="<select class='form-control' multiple='multiple' id='couponIds' name='couponIds'/>";
		            	contentText+="</select>";
		            	contentText+="</div>";
	    			$("#couponSelect").append(contentText);
	    			$(data.coupons).each(function(index,element){
		            	var text="<option value="+element.id+">"+element.couponRule.title+"</option>";
		            	$("#couponIds").append(text);
    				});
    				$('#couponIds').multiselect({
						enableFiltering: true,
					    includeSelectAllOption: true,
					    selectAllText: '全部',
					    selectAllJustVisible: true,
					    buttonWidth: '100%',
					    nonSelectedText: '请选择优惠券',
					    nSelectedText: ' - 已选择',
					    numberDisplayed: 5,
					    allSelectedText: '已选择全部'
					});
				}
		    				
				if(data.passenger.inBlackList){
					$("#membertype").html("黑名单");
				}
				else{
					$("#membertype").html(data.passenger.typeStr);
				}
				$("#todayordernums_div").slideDown();
				
				$("#companyId option").each(function(index,element){
				  	if($(element).attr("value")==data.passenger.companyId){
				 		$(element).attr("selected","selected");
				 		return false;
				 	}
				});
				
				$("#companyId").change();
				
			}
			else{
				$("#allcount").html(0);
				$("#allnotcancelcount").html(0);
				$("#monthcount").html(0);
				$("#monthnotcancelcount").html(0);
				$("#clientVirtual").text("0元");
				$("#membertype").html("新客户");
			}
				
			if(data.orderList && data.orderList.length>0){
				$(".memberOrders-tr").remove();
				$(data.orderList).each(function(index,element){
					var content="<tr class='memberOrders-tr'>";
					if(element.status==0){
						content+="<td><span class='label label-info'>新订单</span></td>";
					}
					else if(element.status==1){
						content+="<td><span class='label label-warning'>已派单</span></td>";
					}
					else{
						content+="<td><span class='label label-danger'>服务中</span></td>";
					}
					content+="<td><a target='_blank' href='${ctx}/order/detail/"+element.id+"'>***"+element.orderNumber.substring(8)+"</a></td>"+
							"<td>"+element.orderType+"</td>"+
							"<td>"+element.fromSource+"</td>"+
							"<td>"+element.serverTimeHI+"</td>"+
							"<td>"+element.fromPlace+"</td>"+
							"<tr>";
					$("#memberOrders-table tbody").append(content);
				});
				
				$("#memberOrders-table").show();
			}
			else{
				$("#memberOrders-table").hide();
			}
				
			var weixinManager=data.weixinManager;
			if(weixinManager!=null){
				if($("#clientName").val()==""){
					$("#clientName").val(weixinManager.name);
				}
					
				if($("#fromPlace").val()==""){
					$("#fromPlace").val(weixinManager.place);
					$("#longitude").val(weixinManager.longitude);
					$("#latitude").val(weixinManager.latitude);
					
					var point = new BMap.Point(weixinManager.longitude,weixinManager.latitude);  
					map.centerAndZoom(point, 12);
	    			map.enableScrollWheelZoom();
	    			var marker = new BMap.Marker(point);  // 创建标注
	    			map.clearOverlays();
	    			map.addOverlay(marker);
				}
			}
				
		});
	});
	
	//改变公司
	$("#companyId").change(function(){
	
		if($("#fromPlace").val()==""){
			var newCity=$("#companyId option:selected").attr("data-city");
			var myGeo = new BMap.Geocoder();
			myGeo.getPoint(newCity, function(point){ 
				if (point) {
					map.centerAndZoom(point, 13);
				    map.enableScrollWheelZoom();
				}
			});
		}
		
		
		$.get('${ctx}/weixinmanager/findByCompany',{'companyId':$(this).val()},function(data){
			if(null!=data &&　data.length>0){
				$("#weixinManagerId").html("");
				$("#weixinManagerId").append("<option value=''>--无--</option>");
				$(data).each(function(index,element){
					var content="<option value='"+element.id+"'>";
					
					content+=element.name;
					
					content+="</option>";
					
					$("#weixinManagerId").append(content);
				});
			}
			else{
				$("#weixinManagerId").html("");
				$("#weixinManagerId").append("<option value=''>--无--</option>");
			}
		});
	});
	
	$("#fixPrice").click(function(e){
		if(this.checked){
			$("#fixPrice_div").slideDown();
		}
		else{
			$("#fixPrice_div").slideUp();
		}
	});
	
	<#if default=="daijia">
	//回车监控
	document.onkeydown = function(e){ 
	    var ev = document.all ? window.event : e;
	    if(ev.keyCode==13) {
	    	$("#btn-position").click();
	    }
	}
	</#if>
	//预约地自动补全
	$('#fromPlace').AutoComplete({
        'data': "${ctx}/order/getHistoryInputedPlace",
		'ajaxDataType': 'json',
        'itemHeight': 24,
        'width': 'auto',
        'async': true,
        'listStyle': 'custom',
        'emphasis': false,
        'matchHandler': function(keyword, data){
            return true;
        },
        'createItemHandler': function(index, data){
            if(data.address.length>14){
        		return "<span title='"+data.address+"'>"+data.address.substring(0,14)+"</span>";
        	}
            return "<span title='"+data.address+"'>"+data.address+"</span>";
        },
        'afterSelectedHandler': function(data){
        	$("#fromPlace").val(data.address);
            $("#btn-position").click();
            markerComplete(data.longitude,data.latitude);
            start_Point[0]=data.longitude;
	        start_Point[1]=data.latitude;
	        if(end_Point.length!=0){
	        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
				var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
				map.centerAndZoom(startPoint, 10); 
				driving2.search(startPoint, endPoint);
	        }
        }
    }).AutoComplete('show');
    
	$('#toPlace').AutoComplete({
        'data': "${ctx}/order/getHistoryInputedPlace",
		'ajaxDataType': 'json',
        'itemHeight': 24,
        'width': 'auto',
        'async': true,
        'listStyle': 'custom',
        'emphasis': false,
        'matchHandler': function(keyword, data){
            return true;
        },
        'createItemHandler': function(index, data){
            if(data.address.length>14){
        		return "<span title='"+data.address+"'>"+data.address.substring(0,14)+"</span>";
        	}
            return "<span title='"+data.address+"'>"+data.address+"</span>";
        },
        'afterSelectedHandler': function(data){
        	$("#toPlace").val(data.address);
            $("#btn_toPlace").click();
            end_Point[0]=data.longitude;
	        end_Point[1]=data.latitude;
	        if(start_Point.length!=0){
	        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
				var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
				map.centerAndZoom(startPoint, 10); 
				driving2.search(startPoint, endPoint);
	        }
        }
    }).AutoComplete('show');
	
});	

//改变驾车路线回调
var markerComplete = function (lng,lat){
  
	$("#longitude").val(lng);
	$("#latitude").val(lat);
	
	//附近服务人员
    $.get('${ctx}/driver/listdistance',{'longitude':lng,'latitude':lat,'orderCarType':"daijia"},function(data){
    	$(".drivers-tr").remove();
		if(data && data.length>0){
			$(data).each(function(i,driver){
				var content="<tr class='drivers-tr'>"+
							"<td><input type='checkbox' name='check_drivers' value='"+driver.id+"' /></td>"+
							"<td>"+driver.realname+"</td>"+
							"<td>"+driver.distance+"</td>"+
							"<td>"+driver.todayOrders+"次</td>"+
							"<td>"+driver.monthOrders+"次</td>"+
							"<tr>";
				$("#drivers-table tbody").append(content);
			});
		}
	});
}

<!--关闭浏览器 -->  
var issubmit = false;
window.onbeforeunload = function () {
	if(!issubmit){
		return ("您确认要离开该页面吗?");
	}
}  
</script>

  </body>
</html>
